home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / util / misc / VMM_src.lha / VMM / vmm.lib / test_vmmlib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-08  |  947 b   |  38 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <clib/exec_protos.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. void *AllocVMem (ULONG size, ULONG attributes);  /* d0, d1 */
  8. void  FreeVMem  (void *block, ULONG size);       /* a1, d0 */
  9. ULONG AvailVMem (ULONG attributes);              /* d1 */
  10.  
  11. #pragma libcall VMBase AllocVMem 1E 1002
  12. #pragma libcall VMBase FreeVMem  24 0902
  13. #pragma libcall VMBase AvailVMem 2A 101
  14.  
  15. struct Library *VMBase;
  16.  
  17. main (void)
  18.  
  19. {
  20. ULONG *buffer;
  21.  
  22. if ((VMBase = OpenLibrary ("vmm.library", 0L)) == NULL)
  23.   {
  24.   printf ("Couldn't open vmm.library\n");
  25.   exit (5);
  26.   }
  27.  
  28. printf ("VM available: %ld\n", AvailVMem (0L));
  29. buffer = AllocVMem (1000L, MEMF_CLEAR);
  30. printf ("Allocated mem at %lx\n", buffer);
  31. printf ("VM available: %ld\n", AvailVMem (0L));
  32. FreeVMem (buffer, 1000L);
  33. printf ("VM available: %ld\n", AvailVMem (0L));
  34. printf ("Largest block: %ld\n", AvailVMem (MEMF_LARGEST));
  35. CloseLibrary (VMBase);
  36. exit (0);
  37. }
  38.